﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MediaCenterExractor
{
    public partial class Browser : Form
    {
        private readonly Uri _uri;
        public string Html { get; set; }

        public Browser(Uri uri)
        {
            _uri = uri;
            InitializeComponent();

            
            Size = new Size(1, 1);
            Visible = false;
            Location = new Point(-1000, -1000);
            webBrowser.Visible = false;
            webBrowser.ScriptErrorsSuppressed = true;
        }

        private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            Html = webBrowser.Document.Body.OuterHtml;

            this.Close();
        }

        private void Browser_Load(object sender, EventArgs e)
        {
            Size = new Size(1, 1);
            Visible = false;
            Location = new Point(-1000, -1000);

            webBrowser.Navigate(_uri);
            this.Hide();
        }
    }
}
